package no.ffi.gismoidm.utils;

import java.util.Date;

public class GeoPosition implements java.io.Serializable {
    private double longitude, latitude, altitude;
    private long time;
    private float bearing;
    
    public GeoPosition(double latitude, double longitude, 
            double altitude, float bearing, long time) {
        setLatitude(latitude);
        setLongitude(longitude);
        setAltitude(altitude);
        setBearing(bearing);
        setTime(time);
    }

    /**
     * @return the longitude
     */
    public double getLongitude() {
        return longitude;
    }

    /**
     * @param longitude the longitude to set
     */
    private void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    /**
     * @return the latitude
     */
    public double getLatitude() {
        return latitude;
    }

    /**
     * @param latitude the latitude to set
     */
    private void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    /**
     * @return the altitude
     */
    public double getAltitude() {
        return altitude;
    }

    /**
     * @param altitude the altitude to set
     */
    private void setAltitude(double altitude) {
        this.altitude = altitude;
    }

    /**
     * @return the time
     */
    public long getTime() {
        return time;
    }

    /**
     * @param time the time to set
     */
    private void setTime(long time) {
        this.time = time;
    }

    /**
     * @return the bearing
     */
    public float getBearing() {
        return bearing;
    }

    /**
     * @param bearing the bearing to set
     */
    public void setBearing(float bearing) {
        this.bearing = bearing;
    }
    
    public String toString() {
        StringBuffer a = new StringBuffer();
        a.append("Geo location:\nLatitude:");
        a.append(latitude);
        a.append("\nLongitude:"); a.append(longitude);
        a.append("\nAltitude:");a.append(altitude);
        a.append("\nBearing:");a.append(bearing);
        a.append("\nFix Time:"); a.append(new Date(time).toString());
        a.append("\n");
        return new String(a);
    }
    
}
